//ConcreteSubject.java
package observer.awt;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.swing.JFrame;

/**
 *@author:youtubezou
 *@version:2012-8-5
 */
public class ConcreteSubject extends JFrame {
	private static final long serialVersionUID = -2962600721059053182L;

	
	public static void main(String[] args) {
		final ConcreteSubject s = new ConcreteSubject();
		
		s.setDefaultCloseOperation(EXIT_ON_CLOSE);
		s.setBounds(100, 100, 500, 500);
		s.addMouseListener(
				new MouseAdapter(){
					@Override
					public void mouseClicked(MouseEvent e){
						s.setTitle("x = " + e.getX() + ", " + "y = " + e.getY());
						System.out.println("x = " + e.getX() + ", " + "y = " + e.getY());
					}
				}
			);
		
		s.setVisible(true);
		List<Integer> list = new ArrayList<Integer>();
		Iterator<Integer> iter = list.iterator();
		while(iter.hasNext()){
			System.out.println(iter.next());
		}
		
	}

}
